package com.ruiyian.bridge.dataAnalysis.controller;

import com.ruiyian.bridge.dataAnalysis.service.DataAnalysisService;
import com.ruiyian.bridge.project.domain.vo.DataAnalysisDto;
import com.ruiyian.common.core.controller.BaseController;
import com.ruiyian.common.core.domain.AjaxResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @author chong
 * @email 673426164@qq.com
 * @create 2022/7/1
 * Desc:
 */
@RestController
@RequestMapping("/bridge/dataAnalysis")
@Slf4j
public class DataAnalysisController extends BaseController {
    @Autowired
    private DataAnalysisService dataAnalysisService;

    /**
     * 相关性分析
     * @param dto
     * @return
     */
    @PostMapping(value = "/getCorrelation")
    public AjaxResult getCorrelation(@RequestBody DataAnalysisDto dto) {
        Map<String, Object> map = dataAnalysisService.getCorrelation(dto);
        return AjaxResult.success(map);
    }

    /**
     * 同期对比
     * @param dto
     * @return
     */
    @PostMapping(value = "/getSamePeriod")
    public AjaxResult samePeriod(@RequestBody DataAnalysisDto dto) {
        Map<String, Object> map = dataAnalysisService.getSanmePeriodList(dto);
        return AjaxResult.success(map);
    }


    /**
     * 频谱分析
     * @param dto
     * @return
     */
    @PostMapping(value = "/getSpectrum")
    public AjaxResult spectrum(@RequestBody DataAnalysisDto dto) {
        Map<String, Object> map = dataAnalysisService.getSpectrumList(dto);
        return AjaxResult.success(map);
    }


    /**
     * 同步分析
     * @param dto
     * @return
     */
    @PostMapping(value = "/getSynchronous")
    public AjaxResult synchronous(@RequestBody DataAnalysisDto dto) {
        Map<String, Object> map = dataAnalysisService.getSynchronous(dto);
        return AjaxResult.success(map);
    }

}
